// Copyright 2008 Philip Allison <sane@not.co.uk>

//    This file is part of Infector.
//
//    Infector is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Infector is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Infector.  If not, see <http://www.gnu.org/licenses/>.


//
// Includes
//

// Standard
#ifdef HAVE_CONFIG_H
#	include "config.h"
#endif

// Language headers
#include <memory>
#include <utility>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <ctime>

// Library headers
#include <glibmm.h>
#include <sigc++/sigc++.h>

// Project headers
#include "gametype.hxx"
#include "boardstate.hxx"
#include "ai.hxx"
#include "game.hxx"


//
// Implementation
//

AI::AI(Game *game, const BoardState *bs, const GameType *gt)
	: m_pBoardState(bs), m_pGameType(gt)
{}

bool AI::makeMove()
{
	if (selectpiece)
	{
		// Select the piece we want to move
		square_clicked(m.source_x, m.source_y);
		selectpiece = false;
		return true;
	} else {
		// Move it
		square_clicked(m.dest_x, m.dest_y);
		// Don't keep firing the timer after this call
		return false;
	}
}
